#include <cstdio>
#include <memory>
typedef long long ll;
using namespace std;
ll x, y, m, n, l;
ll ans_gcd;
pair< ll, ll > exgcd(ll a, ll b, ll &ans) {
	if (b == 0) {
		ans = a;
		return make_pair(1, 0);
	}
	pair< ll, ll > tmp = exgcd(b, a % b, ans);
	ll x, y;
	x = tmp.second;
	y = tmp.first - (a / b) * tmp.second;
	return make_pair(x, y);
}

int main() {
	freopen("testdata.in", "r", stdin);
	freopen("testdata.out", "w", stdout);
	scanf("%lld %lld %lld %lld %lld", &x, &y, &m, &n, &l);
	ll t1 = n - m, t2 = x - y;
	if (t1 < 0) {
		t1 = -t1;
		t2 = -t2;
	}
	ll i = exgcd(t1, l, ans_gcd).first;
	if (t2 % ans_gcd) {
		printf("Impossible");
		return 0;
	}
	printf("%lld", (i * t2 / ans_gcd % (l / ans_gcd) + l / ans_gcd) % (l / ans_gcd));
	return 0;
}